<template>
  <!-- 服务组弹窗 -->
    <Modal v-model="configVisible" title="新增配置集" @on-cancel="configSetManiCancel">
      <div class="modal-add">
        <Form ref="configSetForm" :model="configSetForm" :rules="configSetRules" :label-width="50" label-position="left">
          <FormItem label="名称" prop="name">
            <Input v-model.trim="configSetForm.name" placeholder="请输入名称"></Input>
          </FormItem>
          <FormItem label="描述" prop="description">
            <Input type="textarea" v-model="configSetForm.description" placeholder="请输入描述"></Input>
          </FormItem>
        </Form>
      </div>
      <div slot="footer">
        <Button type="primary" :loading="isAdding" @click="configSetManiConf">确定</Button>
        <Button type="warning" @click="configSetManiCancel">取消</Button>
      </div>
    </Modal>
</template>
<script type="text/javascript">
// import Fetch from '@/api/request'
export default {
  data() {
    return {
      configSetForm: {
        environmentId: '',
        id: '',
        data: {}
      },
      isAdding: false,
      configSetRules: {
      },
      configVisible: false
    }
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    form: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  mounted() {
  },
  methods: {
    // 确认配直集操作
    configSetManiConf() {
    },
    // 取消配置集操作
    configSetManiCancel() {
      this.$emit('update:visible', false)
    }
  },
  watch: {
    visible(val) {
      this.configVisible = val
      if (val) {
        this.configSetForm = Object.assign({}, this.form)
        this.$refs.configSetForm.resetFields()
      }
    }
  }
}
</script>
